import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate";
// 引入各store模块
import configuration from './modules/configuration.js'
import user from './modules/user.js'
import shop from './modules/shop.js'

Vue.use(Vuex)
const store = new Vuex.Store({
	strict: true,
	modules: {
		configuration,
		user,
		shop
	},
	plugins: [
		createPersistedState({
			key: 'vuex',
			paths: ['configuration','user','shop'],
			storage: {
				getItem: key => uni.getStorageSync(key),
				setItem: (key, value) => uni.setStorageSync(key, value),
				removeItem: key => uni.removeStorageSync(key)
			}
		})
	],
})

export default store
